FeedForDev 0.9 Documentation (FeedForDev VCL for Delphi)

Installation: (beta release)

1. Make sure you have Indy internet components installed.  It comes with Delphi 6 and newer, and is a free download for earlier versions (http://www.indyproject.org/Sockets/Download/Borland.iwp).  The Indy source code folder should be in you library path, if correctly installed.

2. Unzip contents of the FeedForDev.zip file to a temporary folder.  Browse to that folder on your system.  Copy the contents of the 'VCL' folder to a location on your drive where you want to keep the FeedForDev component (somewhere under 'program files' is the most common location to put it (you may want to give it its own folder).

3. Inside Delphi, open the .dpk file for the version of Delphi you are running.

4. Click the 'Install' button

5. Add the folder where you put the FeedForDev component to Delphi's library path
   a. From the Delphi menu choose 'Tools' -> 'Environment Options'.  
   b. Select the 'Library' tab.  
   c. Click the browse button '...' next to 'Library Path'.
   d. Click the browse button '...' next to the path field.
   e. Browse to the location where you extracted the FeedForDev.zip file and Click 'OK'.
   f. Click 'Add'.
   g. Click 'OK' on remaining open windows.  


Reference:

Component: TffdRSSReader

Published Properties:

Address - Full path and filename to a local RSS Feed, or full URL (including http://) to a RSS feed on the Internet.

Blocking - When set to True, the GetFeed prodedure call won't return until the feed has been read in (or generates an error).  When set to False, the GetFeed procedure call will return immediately, and then fire the OnFinished event when the feed has been read in (or generates an error).

CategoryFilter - Sets a category filter.  Only feed items that have a matching category entry will show up. You must call GetItems after changing this to re-filter the items.

PubDateStart - When the PubDateFilter property is set to True, feed items with a PubDate older than this will not show up in the current Items.

PubDateEnd - When the PubDateFilter property is set to True, feed items with a PubDate newer than this will not show up in the current Items.

PubDateFilter - When set to True, the PubDateStart and PubDateEnd values will be used to filter what feed items will show up in the current Items.

PubDateSort - Will determine what order feed items will show up in the current Items.  Possible values are: pdsNone, pdsAscending, and pdsDescending. 

LicenseKey - When you purchase a license for FeedForDev you will receive this information.  You will then need to enter it into this field.

LicenseName - When you purchase a license for FeedForDev you will receive this information.  You will then need to enter it into this field.

LicenseSN - When you purchase a license for FeedForDev you will receive this information.  You will then need to enter it into this field.

Registered - If valid license information has not yet been entered, this field will stay False.  It will automatically switch to True after valid license information has been entered.  When FeedForDev is not registered it will intermittently return a notice to that effect as an item's title or description.

Public Properties:

ErrorCode - error while loading RSS Feeds:
	ecNone
	ecFileNotFound
	ecCantDownload
	ecInvalidXML
	ecInvalidRSS

ErrorDescription - A Text version of error while loading RSS Feeds.

FeedTitle - The title of the RSS feed

FeedDescription - The description of the RSS feed

FeedLink - The given in the RSS feed

ItemCount - The number of current Items retrieved from the last GetItems call. The CategoryFilter and PubDateFilter properties can effect which items are available.

ItemNumber - The index number of the current item (first item = 1)

ItemCategory - The category of the current item

ItemTitle - The Title of the current item

ItemDescription - The Description of the current item

ItemLink - The Link of the current item

ItemPubDate - The PubDate of the current item

ItemEnclosureUrl - The url of the current item's enclosure

ItemEnclosureLength - The length of the current item's enclosure

ItemEnclosureType - The mime type of the current item's enclosure

RawFeed - The raw text of the feed. 

Procedures:

Clear - Clears out any loaded feed and its items.  All filters will also be reset to their defaults.

GetFeed - Tries to read in the RSS feed specified by the Address property.  If the address is a URL, then the feed will be downloaded from the Internet.  If the address is a local file path, then the local file will be read in. When GetFeed is called, it will either return immediately, or wait until the feed is downloaded, depending on what the Blocking property is set to.  If GetFeed is successful, the ErrorCode property return ecNone, and the ErrorDescription will be ''.  If GetFeed is successful all the filters (i.e. CategoryFilter, PubDateFilter, and PubDateSort) will be reset back to their defaults and GetItems will be automatically called, so that initially all feed items are available.

GetFeedFromString - Same as GetFeed, but the feed is supplied in as string (or widestring).  This can be used if the program already has a copy of the feed in memory, and FeedForDev doesn't need to download or load the feed file.

GetItems - After making changes to the filters (i.e. CategoryFilter, PubDateFilter, and PubDateSort) call GetItems to return just the matching items.


Basic Usage:

1. Set Address and Blocking properties
2. Call GetFeed
3. Check ErrorCode
4. Set CategoryFilter, PubDateFilter, PubDateStart, and PubDateEnd if desired
5. Call GetItems if filters have been changed, otherwise this isn't necessary
6. Check ItemCount for number of matches
7. Set ItemNumber for the desired item
8. Read desired Item properties (i.e. ItemTitle, ItemDescription, ItemLink, etc.)


Here is an example in Delphi, that shows all of a feed's items that belong to the 'Tips' category (only the title for each item is displayed):

Start a new project and put a ffdRssReader, a button and a memo control on the form.  Modify the OnClick event for the button as follows:

procedure TForm1.Button1Click(Sender: TObject);
begin
  ffdRSSReader1.Address := 'http://www.feedfordev.com/sample-feed.xml';
  ffdRSSReader1.GetFeed;
  if ffdRSSReader1.ErrorCode = ecNone then begin
    ffdRSSReader1.CategoryFilter := 'Tip';
    ffdRSSReader1.GetItems;
    ffdRSSReader1.ItemNumber := 1;
    if ffdRSSReader1.ItemCount > 0 then begin
      while ffdRSSReader1.ItemNumber <= ffdRSSReader1.ItemCount do begin
        Memo1.Lines.Add(ffdRSSReader1.ItemTitle);
        ffdRSSReader1.ItemNumber := ffdRSSReader1.ItemNumber + 1;
      end;
    end
    else begin
      ShowMessage('No items in the feed had ''Tip'' for the category');
    end;
  end
  else begin
    ShowMessage(ffdRSSReader1.ErrorDescription);
  end;
end;


A more robust demo project is included in the download file, in a folder named 'Demo'.


Thanks for trying FeedForDev

The FeedForDev Team
www.feedfordev.com
support@feedfordev.com
www.feedfordev.com/forum
